package com.example.qxfw.cshx.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.qxfw.common.entity.zy.CcshxImpDot;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
@DS("service")
public interface CcshxImpDotMapper extends BaseMapper<CcshxImpDot> {

    @Select("select name, lon, lat, principal, tel " +
            "from ccshx_imp_dot " +
            "where joinstation='${joinStation}' ")
    List<CcshxImpDot> selectList1(String joinStation);

    @Select("select id,name " +
            "from ccshx_imp_dot " +
            "where Name = '${name}'")
    List<CcshxImpDot> selectList2(String name);


    /**
     * 根据关联站点查询重要地点信息
     * @param stationNames 站点名称列表
     * @return 重要地点列表
     */
    @Select({
            "<script>",
            "SELECT * FROM ccshx_imp_dot",
            "<where>",
            "   <if test='stationNames != null and !stationNames.isEmpty()'>",
            "       joinstation IN",
            "       <foreach item='station' collection='stationNames' open='(' separator=',' close=')'>",
            "           #{station}",
            "       </foreach>",
            "   </if>",
            "</where>",
            "</script>"
    })
    List<CcshxImpDot> selectByStationNames(@Param("stationNames") List<String> stationNames);


}
